
import 'package:flutter_blue/flutter_blue.dart';

class ScanDevice {
  FlutterBlue flutterBlue = FlutterBlue.instance;

  StarScan() {
    // Start scanning
    flutterBlue.startScan(timeout: Duration(seconds: 4));
// Listen to scan results
    var subscription = flutterBlue.scanResults.listen((results) {
      for (ScanResult r in results) {
        if(r.advertisementData.serviceUuids.length>0){

        }
        print("${r.advertisementData.serviceUuids}");
        // print('${r.device.name} found! rssi: ${r.rssi}');
      }
    });

  }
  StopScan(){
    // Stop scanning
    flutterBlue.stopScan();
  }
}
